
  

      
      <h2 style="margin-bottom:20px;"><?php echo $rider->number." - ".$rider->last_name." ".$rider->first_name;?> (<?php echo anchor('info/team/'.$rider->team_id, $rider->team_name);?>)</h2>
      <div class='row'>
          <div class='span4'>
            <div class='panel'>
              <?php
              if($number_of_selections > 0)
              {
              ?>  
              <p><?php echo sprintf(lang('rider_selections'), $rider->first_name." ".$rider->last_name, $number_of_selections);?>:</p>
              <?php
              }
              else
              {
              ?>
              <p><?php echo sprintf(lang('rider_no_selections'), $rider->first_name." ".$rider->last_name);?>:</p>
              <?php
              }
              ?>
              <?php
              if(isset($user_teams))
              {
              ?>
              <p>
                <?php
                $teams_string = "";
                foreach($user_teams as $team)
                {
                  $teams_string .= " ".anchor('info/user_teams/'.$team->user_id, $team->username).",";
                }
                echo trim($teams_string,',');

                ?>
              </p>
              <?php } ?>
            </div>
          </div>
          <div class='span8'>
            <div class='panel'>
              <h3><?php echo sprintf(lang('points_scored_by_rider'), $rider->first_name." ".$rider->last_name);?>:</h3>
              <table class='table table-condensed table-striped'>
                <thead>
                  <tr>
                    <th colspan='2'><?php echo lang('stage');?></th>
                    <th class='centertext'><img src="<?php echo base_url();?>assets/images/jersey_stage.gif" /></th>
                    <th class='centertext'><img src="<?php echo base_url();?>assets/images/jersey_yellow.gif" /></th>
                    <th class='centertext'><img src="<?php echo base_url();?>assets/images/jersey_green.gif" /></th>
                    <th class='centertext'><img src="<?php echo base_url();?>assets/images/jersey_mountain.gif" /></th>
                    <th class='centertext'><?php echo lang('total'); ?></th>
                  </tr>
                </thead>
                <tbody>
                  <?php
                  $total_points = 0;
                  foreach($rider->stage_points as $stage_id => $points)
                  {
                    $stage = $this->stages_model->get_by_id($stage_id);
                  ?>
                  <tr>
                    <td><?php echo $stage_id.". ";?></td>
                    <td><?php echo $stage->stage_depart." - ".$stage->stage_arrive." (".lang($stage->stage_type).", ".$stage->stage_distance.")";?></td>
                    <?php if($points > 0) { ?>
                    <td class='centertext'><?php echo $points;?></td>
                    <?php } else { ?>
                    <td class='centertext'> - </td>
                    <?php  } ?>
                    <?php if($rider->yellow_points[$stage_id] > 0) { ?>
                    <td class='centertext'><?php echo $rider->yellow_points[$stage_id];?></td>
                    <?php } else { ?>
                    <td class='centertext'> - </td>
                    <?php } ?>
                    <?php if($rider->green_points[$stage_id] > 0) { ?>
                    <td class='centertext'><?php echo $rider->green_points[$stage_id];?></td>
                    <?php } else { ?>
                    <td class='centertext'> - </td>
                    <?php } ?>            
                    <?php if($rider->mountain_points[$stage_id] > 0) { ?>
                    <td class='centertext'><?php echo $rider->mountain_points[$stage_id];?></td>
                    <?php } else { ?>
                    <td class='centertext'> - </td>
                    <?php } ?>
                    <td class='centertext'><?php if ($points + $rider->yellow_points[$stage_id] + $rider->green_points[$stage_id] + $rider->mountain_points[$stage_id] > 0) 
                                                 {
                                                  echo $points + $rider->yellow_points[$stage_id] + $rider->green_points[$stage_id] + $rider->mountain_points[$stage_id];
                                                 }
                                                  else
                                                  {
                                                    echo "-";
                                                  }?>
                    </td>
                  </tr>
                  <?php
                  $total_points = $total_points + $points + $rider->yellow_points[$stage_id] + $rider->green_points[$stage_id] + $rider->mountain_points[$stage_id];
                  }
                  ?>
                </tbody>
                <tfoot>
                  <tr>
                    <td colspan='5'></td>
                    <td><?php echo lang('total');?></td>
                    <td class='centertext'><?php echo $total_points;?></td>
                  </tr>
                </tfoot>
              </table>
            </div>
          </div>
      </div>
 